package com.neuedu.listener;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

/**
 * 项目：      CrossDomain
 * 类名:       MyServletRequestListener
 * 创建时间：  2020/12/17  16:40
 * 描述 :
 * 作者 :     张金山
 * QQ :     314649444
 * Site:      https://jshand.gitee.io
 */
@WebListener
public class MyServletRequestListener implements ServletRequestListener {


    @Override
    public void requestInitialized(ServletRequestEvent sre) {

        HttpServletRequest  request = (HttpServletRequest) sre.getServletRequest();
        System.out.println("请求对象被创建:MyServletRequestListener.requestInitialized");
        System.out.println("请求：路径："+request.getRequestURL().toString());
        System.out.println("请求：路径："+request.getRequestURI());

    }


    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        System.out.println("请求对象被销毁:MyServletRequestListener.requestDestroyed");
    }
}